package com.example.yin.service.impl;


import com.example.yin.dao.ShowMapper;
import com.example.yin.domain.Article;
import com.example.yin.domain.Show;
import com.example.yin.service.ShowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShowServiceImpl implements ShowService {

    @Autowired
    private ShowMapper showMapper;

    @Override
    public boolean add(Show show) {
        int insert = showMapper.insert(show);
        if (insert > 0){
            return true;
        }
        return false;
    }

    @Override
    public boolean delete(Integer show_id) {
        int delete = showMapper.deleteByPrimaryKey(show_id);
        if (delete > 0){
            return true;
        }
        return false;
    }

    @Override
    public boolean update(Show show) {
        int i = showMapper.updateByPrimaryKey(show);
        if (i > 0){
            return true;
        }
        return false;
    }

    @Override
    public Show getDetail(Integer show_id) {
        Show show = showMapper.selectByPrimaryKey(show_id);
        if (show != null){
            return show;
        }
        return null;
    }

    @Override
    public boolean updateShowPic(Show show) {
        return showMapper.updateShowPic(show)>0?true:false;
    }

    @Override
    public List<Show> getList(Show show) {
        List<Show> list = showMapper.getList(show);
        if (list != null){
            return list;
        }
        return null;
    }
}
